<?php
class Ftl_Environment
{
    // <editor-fold defaultstate="collapsed" desc="Ftl_Environment::CONSTANTS">
    const LOCAL         = 'LOCAL';
    const DEVELOPMENT   = 'DEVELOPMENT';
    const STAGING       = 'STAGING';
    const PRODUCTION    = 'PRODUCTION';
    // </editor-fold>

    public static function detect()
    {
        $host       = $_SERVER['HTTP_HOST'];

        $servers    = array
        (
            self::LOCAL        => array
            (
                "localhost",
                "localhost:8080",
                "127.0.0.1"
            ),
            self::DEVELOPMENT   => array
            (
                "staging.webar.net:8070",
                "webar2"
            ),
            self::STAGING      => array    (),
            self::PRODUCTION   => array    ("room23.com.ar")

        );

        if (in_array($host, $servers[self::PRODUCTION]))
        {
                return self::PRODUCTION;
        }
        else if (in_array($host, $servers[self::STAGING]))
        {
                return self::STAGING;
        }
        else if (in_array($host, $servers[self::DEVELOPMENT]))
        {
                return self::DEVELOPMENT;
        }
        else if (in_array($host, $servers[self::LOCAL]))
        {
                return self::LOCAL;
        }
        else
                return -1;

    }
}

?>
